<template>
  <view class="u-page">
		<view class="u-demo-block">
			<view class="block__content">
				<u-subsection
					:list="tabList"
					mode="subsection"
					activeColor="#f56c6c"
					:current="current"
					@change="tabsChange"
				></u-subsection>
			</view>
		</view>
		<view>
			<u-gap height="5"></u-gap>
		</view>
		<view class="content" > 
			<view v-if="current==0">
				<task></task>
			</view>
			<view v-else-if="current==1">
				<goods></goods>
			</view>
		</view>
		  
  </view>
</template>

<script>
	import task from './task/index';
	import goods from './goods/index';
	import Cache from '@/utils/cache';
	import {mapGetters} from "vuex";
	import {toLogin} from '@/libs/login.js';
    export default {
		components:{
			goods,
			task
		},
		computed: mapGetters(['isLogin', 'chatUrl', 'userInfo', 'uid']),
        data() {
            return {
                tabList: [{
                    name: '发布任务',
                }, {
                    name: '发布商品',
                }],
				activeColor:"red",
				current: 0, // tabs组件的current值，表示当前活动的tab选项
            }
        },
		onShow() {
			let that = this;
			if (that.isLogin) {
				that.$store.dispatch('USERINFO');
			} else {
				toLogin();
			}
		},
		methods:{
			tabsChange(index){
				this.current = index;
			}
		}
		
    }
</script>
<style scoped lang="scss">
	.block__title{
		font-size: 35rpx;
		margin-top: 5px;
	}
	.block__content{
		padding: 10rpx;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
	}
	.content{
		padding-top: 10rpx;
	}
</style>
